<?php
include 'portlet_header.php';
if (getParameter("operation")!=null) $operation=getParameter("operation");
if (getParameter("portalId")!=null) $portalId=getParameter("portalId");
if (getParameter("module")!=null) $module=getParameter("module");



if ($module=="portal_credentials")
{
    if ($operation=="updateobject"){

        $sSql="SELECT name FROM portal_objects where id=".getParameter("objectname");


        $rs=$GLOBALS["conn"]->Execute($sSql);


    $sSql ="SELECT name as lib, id as value FROM ".$rs->fields["name"]."  WHERE `portalId` =".$portalId.";";
 // echo $sSql ;
  $rs=$GLOBALS["conn"]->Execute($sSql);

        ?>
    <select name="x_objectId" class="text ui-widget-content ui-corner-all" style="min-width:200px">
        <option  value=""></option>
        <?php

        while (!$rs->EOF)  {

            if ($rs->fields["value"]==getParameter("id")) $selected="selected=\"selected\""; else $selected="";

            ?>
            <option <?php echo $selected; ?> value="<?php echo $rs->fields["value"]; ?>"><?php echo $rs->fields["lib"]; ?></option>
            <?php
            $rs->MoveNext();
        }

        ?>

    </select>

    <?php }


}
include 'portlet_footer.php';
?>